<template>
	<view class="inform">
		<headertop title="意见反馈" str1="oridei" :back1="back1"></headertop>
		<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Rectangle 21541@2x.png" class="inform_back"
			mode=""></image>
		<view class="fomrs">
			<view class="fomrs_line">
				<view class="t1">
					请选择反馈类型
				</view>
				<view class="inputbopx" @click="show=true">
					<input type="text" v-model="form.feedtype" :disabled="true" placeholder="请选择" />
					<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Frame@2x.png" mode=""></image>
				</view>
			</view>
			<view class="fomrs_line">
				<view class="t1">
					反馈标题
				</view>
				<view class="inputbopx">
					<input v-model="form.title" type="text" placeholder="请输入反馈标题" />
				</view>
			</view>
			<view class="fomrs_line">
				<view class="t1">
					问题描述
				</view>
				<view class="inputbopx1">
					<textarea name="" v-model="form.content" id="" placeholder="请输入问题描述" cols="30" rows="10"></textarea>
				</view>
			</view>
		</view>
		<view class="" style="height: 200rpx;">

		</view>
		<view class="fixedbox">
			<view class="btn" @click="save">
				提交
			</view>
		</view>
		<u-picker @confirm="confirm" @cancel="show=false" :show="show" keyName="title" :columns="columns"></u-picker>
	</view>
</template>

<script>
	import {
		feedtype,
		addfeed
	} from '@/common/api/api.js'
	import headertop from '@/components/header.vue'
	export default {
		components: {
			headertop
		},
		data() {
			return {
				back1: 0,
				show: false,
				columns: [],
				form: {
					feedtype: '',
					title: '',
					content: ''
				}
			}
		},
		onLoad() {
			this.inittype()
		},

		methods: {
			async save() {
				for (var i in this.form) {
					if (!this.form[i]) {
						uni.showToast({
							title: '内容不能为空',
							icon: 'none'
						})
						return
					}
				}
				const res = await addfeed(this.form)
				if (res.code == 1) {
					setTimeout(() => {
						uni.showToast({
							title: '提交成功'
						})
					}, 500)
					uni.switchTab({
						url: '/pages/my/index'
					})
				}
			},
			async inittype() {
				const res = await feedtype()
				if (res.code == 1) {
					this.columns = [res.data]
				}
			},
			confirm(e) {
				console.log('confirm', e)
				this.form.feedtype = e.value[0]['title']
				this.show = false
			}
		},
		onPageScroll(e) {
			console.log(e, 'eeeeeeeeeeeeeee');
			if (e.scrollTop > 100) {
				this.back1 = '#A2AEFF'
			} else {
				this.back1 = ''
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F7F8FA;
	}

	.inform {
		width: 100%;
		overflow: hidden;
		position: relative;

		.fixedbox {
			width: 100%;
			overflow: hidden;
			height: 184rpx;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			position: fixed;
			bottom: 0%;

			.btn {
				width: 686rpx;
				height: 88rpx;
				background: #8278FF;
				border-radius: 16rpx;
				text-align: center;
				line-height: 88rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #FFFFFF;
				text-align: center;
				line-height: 88rpx;
				margin: auto;
				margin-top: 22rpx;
			}
		}

		&_back {
			width: 100%;
			height: 278rpx;
			position: absolute;
			z-index: -1;
		}

		.fomrs {
			width: 686rpx;
			margin: auto;
			overflow: hidden;
			margin-top: 204rpx;

			&_line {
				width: 100%;
				overflow: hidden;
			}

			.t1 {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #1D2129;
				margin-top: 32rpx;
			}

			.inputbopx1 {
				width: 686rpx;
				border-radius: 12rpx 12rpx 12rpx 12rpx;
				margin-top: 20rpx;
				overflow: hidden;
				background: #FFFFFF;

				textarea {
					width: 650rpx;
					margin-top: 24rpx;
					margin-left: 28rpx;
				}
			}

			.inputbopx {
				width: 686rpx;
				height: 88rpx;
				background: #FFFFFF;
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				margin-top: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				input {
					width: 650rpx;
					margin-left: 28rpx;
				}

				image {
					width: 32rpx;
					height: 32rpx;
					margin-right: 28rpx;
				}
			}
		}






	}
</style>